Linkers for producing executable programs are known. Generally speaking, a linker acts to link a number of object code modules to form a single executable program. Object code modules are usually generated from program source code modules, these modules being written in a high level language. An assembler/compiler reads each source code module and assembles and/or compiles the high level language of the source code module to produce an object code module. The assembler also generates a number of relocations that are used to combine the object code modules at link time in a linker. In addition to the user generated object code modules, object code modules defining commonly used code sequences may be stored in libraries to be retrieved by the linker at link time if necessary.
One of the issues that must be resolved at the outset of any linking scheme is that of the endianness of the target processor, the target processor being the processor on which the final executable program is to run. Big-endian and little-endian are terms which refer to the order in which a sequence of bytes are stored in memory. In Big-endian architectures the most significant byte (the “big end”) is stored first i.e. at the lowest memory address. In Little-endian architectures the least significant byte (the “little end”) is stored first. For example, consider the number 1025 stored in a 4-byte integer. Written out in full it would appear as 00000000 00000000 00000100 00000001. The following table shows how it would be stored in big and little endian architectures:
AddressBig-EndianLittle-Endian000000000000000001010000000000000100020000010000000000030000000100000000
The endianness of each object code module, including the libraries must be the same as that of the target processor.
However some target processors may be bi-endian. A bi-endian processor is a processor that can use either endian system. For bi-endian processors two versions of the object code libraries are needed, one big-endian version and one little-endian version. This is clearly disadvantageous, both in terms of the time and resources expended in generating both library versions and in terms of the additional storage overhead incurred in storing both versions.
It is an aim of embodiments of the present invention to alleviate this disadvantage by providing a linker and method of linking using bi-endian libraries.